package com.wlyuan.open.domain.api.utils;


import com.wlyuan.open.domain.api.valueobj.OpenApiDocId;
import lombok.extern.slf4j.Slf4j;

import java.util.Optional;

/**
 * @author yuanzheng
 */
@Slf4j
public class MappingOpenApiDoc {
    public OpenApiDocId createOpenApiDocId(Long value) {
        return Optional.ofNullable(value)
                .map(OpenApiDocId::new)
                .orElse(null);
    }

    public Long value(OpenApiDocId source) {
        return Optional.ofNullable(source).map(s -> s.getId()).orElse(null);
    }
}
